#include <iostream>
#include<stack>
using namespace std;

int main()
{
    string str;
    cin >> str;
    string tmp;
    tmp += str[0];
    for (int i = 1; i < str.size(); i++)
    {
        if (str[i] == tmp.back())
        {
            tmp.pop_back();
        }
        else {
            tmp += str[i];
        }
    }
    if (tmp.empty())
    {
        cout << 0;
    }
    else {
        cout << tmp;
    }

}